package com.xh.audit.vo.webform;

import com.mybatisflex.core.query.QueryWrapper;
import com.xh.audit.entity.project.Project;
import lombok.Data;
import lombok.EqualsAndHashCode;

import static com.xh.audit.entity.project.table.ProjectTableDef.PROJECT;


@Data
@EqualsAndHashCode(callSuper = true)
public class ProjectQuery extends PageParams<Project> {
    private String projectCode;
    private String projectName;
    private Integer projectYear;
    private Integer projectPlan;
    private Integer auditCode;


    public QueryWrapper queryWrapperBuild() {
        QueryWrapper queryWrapper = QueryWrapper.create()
                .and(PROJECT.PROJECT_YEAR.eq(projectYear))
                .and(PROJECT.PROJECT_CODE.eq(projectCode))
                .and(PROJECT.PROJECT_PLAN.eq(projectPlan))
                .and(PROJECT.AUDIT_CODE.eq(auditCode))
                .and(PROJECT.PROJECT_NAME.likeLeft(projectName));
        return queryWrapper;
    }
}
